<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>黔南民族师范学院综合教育学分认定系统</title>

    <link rel="stylesheet" href="/jquery-easyui-1.3.5/themes/icon.css" />
    <link rel="stylesheet" href="/jquery-easyui-1.3.5/themes/default/easyui.css"/>

    <script type="text/javascript" src="/jquery-easyui-1.3.5/jquery.min.js"></script>
    <script type="text/javascript" src="/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
    <style type="text/css" th:inline="none">
        form div{
            margin:20px auto;
            width:250px;
            text-align:center
        }

    </style>
    <script type="text/javascript" th:inline="none">
        $(function(){
            $("input[name=studentNumber]").validatebox({
                required:true,
                missingMessage:'请输入学号'
            });
            $("input[name=studentName]").validatebox({
                required:true,
                missingMessage:'请输入姓名'
            });
            $("input[name=identityCard]").validatebox({
                required:true,
                missingMessage:'请输入身份证号'
            });
            $("input[name=enrollmentDate]").validatebox({
                required:true,
                missingMessage:'请输入入学年份'
            });
            $("input[name=grade]").validatebox({
                required:true,
                missingMessage:'请输入年级'
            });
            $("input[name=educationBackground]").validatebox({
                required:true,
                missingMessage:'请输入学历'
            });
            $("input[name=year]").validatebox({
                required:true,
                missingMessage:'请输入学制'
            });

            $('#ccs').combobox({
                url:'/school/queryAll',
                valueField:'id',
                textField:'name',
                panelHeigth:'auto',
                panelWidth:140,
                width:160,
                editable:false,
                required:true,
                missingMessage:'请选择所属学院',
                onSelect:function(rec){
                    $('#ccm').combobox({
                        url:'/major/queryMajorsJson',
                        valueField:'id',
                        textField:'name',
                        panelHeigth:'auto',
                        panelWidth:140,
                        width:160,
                        editable:false,
                        required:true,
                        missingMessage:'请选择所属专业'
                    });
                }
            });

            $('#cc').combobox({
                url:'/class/queryAllClassJson',
                valueField:'id',
                textField:'className',
                panelHeigth:'auto',
                panelWidth:140,
                width:160,
                editable:false,
                required:true,
                missingMessage:'请选择所属班级'
            });

            $("#ff").form("disableValidation");

            $("#btn").click(function(){
                $("#ff").form("enableValidation");
                if($("#ff").form("validate")){
                    $("#ff").form('submit',{
                            url:'/student/studentSave',
                            success:function(){
                                parent.$("#win").window("close");
                                parent.$("iframe[title='学生信息管理']").get(0).contentWindow.$("#dg").datagrid("reload");
                            }
                        }
                    );
                }
            });
        });

    </script>
</head>

<body>
<form id="ff" method="post">
    <div>
        <label>学院:</label>
        <input id="ccs" name="sid"></input>
    </div>
    <div>
        <label>专业:</label>
        <input id="ccm" name="mid"></input>
    </div>
    <div>
        <label>班级:</label>
        <input id="cc" name="cid"></input>
    </div>
    <div>
        <label>学号:</label>
        <input type="text" name="studentNumber" />
    </div>
    <div>
        <label>姓名:</label>
        <input type="text" name="studentName" />
    </div>

    <div>
        <label >性别:</label>
        <input type="radio" name="gender" value="true" checked="checked"/>男
        <input type="radio" name="gender" value="false"/>女
    </div>
    <div>
        <label>身份证号:</label>
        <input type="text" name="identityCard" />
    </div>
    <div>
        <label >入学年份:</label>
        <input type="text" name="enrollmentDate" />
    </div>
    <div>
        <label >年级:</label>
        <input type="text" name="grade" />
    </div>
    <div>
        <label >学历:</label>
        <input type="text" name="educationBackground" />
    </div>
    <div>
        <label >学制:</label>
        <input type="text" name="year" />
    </div>
    <div>
        <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加学生</a>
    </div>
</form>
</body>
</html>
